﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ListItemEventInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Xml.Serialization;

    using Microsoft.SharePoint;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [CollaborisClass(
      Title = "List Item Event Info",
      ReleaseStatus = ReleaseStatus.Beta,
      DisableDocumentation = false,
      ContactAuthorEmail = "Support@Collaboris.co.uk",
      Summary = "Defines the parameters to define a list item event."
     )]
    [Serializable]
    public class ListItemEventInfo : WSSEntityBase
    {
        #region Fields (2)

        /// <summary>
        /// name of the list.
        /// </summary>
        private string listName;

        /// <summary>
        /// name of the assembly containing the list event handler.
        /// </summary>
        private string assemblyName;

        /// <summary>
        /// name of the event handler class.
        /// </summary>
        private string className;

        /// <summary>
        /// List event item receiver type.
        /// </summary>
        private SPEventReceiverType? eventReceiverType;

        #endregion Fields

        #region Properties (2)

        [XmlAttribute]
        [CollaborisProperty(
            Summary = "The name of the list.",
            Title = "List Name",
            Example = "Pages",
            Required = true,
            InputHint = InputHint.SingleText)]
        public string ListName
        {
            get
            {
                return this.listName;
            }

            set
            {
                this.listName = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
            Summary = "The class name implementing the event receiver.",
            Title = "Class Name",
            Example = "Collaboris.Utils.Tests.TestEventReceiver",
            Required = true,
            InputHint = InputHint.SingleText)]
        public string ClassName
        {
            get
            {
                return this.className;
            }

            set
            {
                this.className = value;
            }
        }

        [XmlAttribute]
        [CollaborisProperty(
            Summary = "The full assembly name containing the event receiver.",
            Title = "Assembly Name",
            Example = "Collaboris.Utils.Tests, version=2.0.0.0,Culture=neutral, PublicKeyToken=182db3eac6a9e195",
            Required = true,
            InputHint = InputHint.SingleText)]
        public string AssemblyName
        {
            get
            {
                return this.assemblyName;
            }

            set
            {
                this.assemblyName = value;
            }
        }

        [CollaborisProperty(
              Summary = "The type of receiver.",
              Title = "Event Receiver Type",
              Example = "ItemAdded",
              Required = true,
              Remarks = @"For a list of possible values please look at <a href=""http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.speventreceivertype.aspx"">'SPEventReceiverType Enumeration (Microsoft.SharePoint)'</a>.",
              InputHint = InputHint.NullableEnum)]
        [XmlElement(IsNullable = true)] 
        public SPEventReceiverType? EventReceiverType
        {
            get
            {
                return this.eventReceiverType;
            }

            set
            {
                this.eventReceiverType = value;
            }
        }

        #endregion Properties
    }
}